#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int x,sum=0;
  char c;
  cin>>x>>c;
  sum=x<=1000?8:8+4*ceil((x-1000.0)/500);
  sum+=(c=='y'?5:0);
  cout<<sum;
}